import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

// HJ31 单词倒排
public class HJ31 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {

            String str = sc.nextLine();
            str = str.replaceAll("[^a-zA-Z]", " ");
            str = fun1(str);
            String[] strs = str.split(" ");
            for (int i = strs.length - 1; i >= 0; i--) {
                System.out.printf(strs[i]+" ");
            }

            // 简略，直接分割
//            String str = sc.nextLine();
//            String[] strs = str.split("[^a-zA-Z]");
//            for (int i = strs.length - 1; i >= 0; i--) {
//                System.out.printf(strs[i]+" ");
//            }
        }
    }
    // 去掉字符串多余的空格
    public static String fun1(String s) {
        //获取两个空格的索引
        int index = s.indexOf("  ");
        while (index != -1) {
            //字符串拼接
            s = s.substring(0, index).concat(s.substring(index + 1));
            index = s.indexOf("  ");
        }
        return s;
    }

}
